﻿<UserControl x:Class="Microsoft.Research.ScientificWorkflow.ManagementStudioControls.RegistryManagerModule.CategoryEditorView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             Name="categoryViewMiddlePane" AutomationProperties.AutomationId="categoryViewMiddlePane" >
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="boolToVisibilityConverter"/>
    </UserControl.Resources>
    <Grid>
        <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="4,4,4,4" BorderThickness="1,1,1,1" Background="#FFFFFFFF" BorderBrush="#FFE0E0E0">
            <Grid Margin="0,0,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*" MinHeight="160" />
                    <RowDefinition Height="40" />
                </Grid.RowDefinitions>
               
                        <Grid Margin="0,0,0,0" Grid.Row="0">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="36"/>
                                <RowDefinition Height="36"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                        <Border Margin="0,0,0,0" CornerRadius="5,5,0,0" BorderThickness="0,0,0,1" BorderBrush="#FFFFFFFF" Grid.Row="0">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                    <GradientStop Color="#FFE8E8E8" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.Background>
                            <TextBlock Text="{Binding Path=EditableCategoryModel.CenterPaneHeader}" TextWrapping="Wrap" FontSize="14" FontWeight="Normal" Margin="7,2,0,0"/>
                        </Border>
                    <Border CornerRadius="5,5,0,0" Grid.Row="1">

                        <Border.Background>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FFFBFBFB" Offset="0"/>
                                <GradientStop Color="#FFF0F0F0" Offset="1"/>
                            </LinearGradientBrush>
                        </Border.Background>
                        <StackPanel Grid.Row="1" Visibility="{Binding Path=EditableCategoryModel.IsNotVirtualCategory, Converter={StaticResource boolToVisibilityConverter}}" Orientation="Horizontal">
                            <Button AutomationProperties.AutomationId="btnAdd" Style="{DynamicResource AddCategoryButton}" Command="{Binding Path=NewCategoryCommand}" Width="26" Height="26" Content="Button" x:Name="AddButton" ToolTip="New" Margin="5,0,0,0"/>
                            <Button AutomationProperties.AutomationId="btnDelete" Style="{DynamicResource deleteButton}" Visibility="{Binding Converter={StaticResource boolToVisibilityConverter}, Path=AllowDelete}" Command="{Binding Path=DeleteCategoryCommand}" Width="26" Height="26" Content="Button" x:Name="DeleteButton" ToolTip="Delete" Margin="5,0,0,0"/>
                            <Button AutomationProperties.AutomationId="btnNewWorkflow" Style="{DynamicResource NewWorkflowButton}" Visibility="{Binding Converter={StaticResource boolToVisibilityConverter}, Path=EditableCategoryModel.DisplayWorkflowCreate}" Command="{Binding Path=NewWorkflowCommand}" Width="26" Height="26" Content="Button" x:Name="AddWFButton" ToolTip="Create Workflow" Margin="5,0,0,0"/>
                            <Button AutomationProperties.AutomationId="btnImportWorkflow" Style="{DynamicResource ButtonStyleImportBtn}" Visibility="{Binding Converter={StaticResource boolToVisibilityConverter}, Path=EditableCategoryModel.DisplayWorkflowCreate}" Command="{Binding Path=ImportWorkflowCommand}" Width="26" Height="26" Content="Button" x:Name="AddButton_Copy" ToolTip="Import Workflow" Margin="5,0,0,0"/>
                        </StackPanel>
                    </Border>
                    <Grid Grid.Row="2" HorizontalAlignment="Stretch" Margin="0,0,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="72"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Image Width="72" HorizontalAlignment="Left" VerticalAlignment="Top" Source="/Microsoft.Research.ScientificWorkflow.TridentUtilities;component/Images/ManagementStudio/categoriesHeaderPic.png"/>
                            <TextBlock AutomationProperties.AutomationId="txtBlkDescription"  HorizontalAlignment="Left" VerticalAlignment="Top" Text="{Binding Path=EditableCategoryModel.DescriptiveText}" TextWrapping="Wrap" Grid.Column="1" TextAlignment="Justify" Margin="10,0,0,0"/>
                        </Grid>
                    </Grid>
    
 
                <ScrollViewer  Grid.Row="1" Margin="10,0,10,10"  VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
                    <Grid VerticalAlignment="Stretch" Margin="5,0,5,5"  >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <StackPanel  Visibility="{Binding Path=EditableCategoryModel.IsNotVirtualCategory, Converter={StaticResource boolToVisibilityConverter}}" Margin="50,0,0,0" Grid.RowSpan="1" Grid.Row="0">
                            <Border CornerRadius="5,5,5,5" BorderThickness="0,0,0,0" BorderBrush="#FFC4C4C4" Background="#FFFFFFFF" Margin="0,15,10,0">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="115"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" MinHeight="7.19999999999999"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock AutomationProperties.AutomationId="idTxtBlk" HorizontalAlignment="Right" VerticalAlignment="Top" Text="ID:" TextWrapping="Wrap" Margin="0,5,5,0" Grid.RowSpan="1" Grid.Row="0"/>
                                    <Grid VerticalAlignment="Top" Grid.Row="1" Margin="0,5,8,0" HorizontalAlignment="Right">
                                        <Grid Margin="0,-0.5,-7.5,0" Width="8" Height="8" HorizontalAlignment="Right" VerticalAlignment="Top">
                                            <Path RenderTransformOrigin="0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom" Fill="#FFFF0000" Stretch="Fill" StrokeThickness="0" Data="M18.597656,17.335052 L25.59375,17.335052 L25.382813,29.253021 L36.210938,22.010834 L39.832031,27.424896 L27.667969,34.561615 L39.832031,41.768646 L36.210938,47.112396 L25.242188,39.624115 L25.628906,51.85849 L18.597656,51.85849 L18.808594,39.975677 L8.0859375,47.147552 L4.5,41.73349 L16.59375,34.596771 L4.5703125,27.38974 L8.0859375,21.975677 L18.808594,29.253021 z">
                                                <Path.RenderTransform>
                                                    <TransformGroup>
                                                        <ScaleTransform ScaleX="0.7" ScaleY="0.7"/>
                                                        <SkewTransform AngleX="0" AngleY="0"/>
                                                        <RotateTransform Angle="0"/>
                                                        <TranslateTransform X="0" Y="0"/>
                                                    </TransformGroup>
                                                </Path.RenderTransform>
                                            </Path>
                                        </Grid>
                                        <TextBlock Margin="-2,0,0,0" AutomationProperties.AutomationId="idName" HorizontalAlignment="Right" Text="Name:" TextWrapping="Wrap"/>
                                    </Grid>
                                    <TextBox IsEnabled="{Binding Path=NonSystemItem}" MaxLength="75" MaxLines="3" AutomationProperties.AutomationId="txtbxNameCategory" Text="{Binding Path=EditableCategoryModel.Name, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="250" Grid.Column="1" TextWrapping="Wrap" Margin="0,5,0,0" Grid.Row="1"/>
                                    <TextBox IsEnabled="{Binding Path=NonSystemItem}" MaxLines="5" AutomationProperties.AutomationId="txtblkDescCategory" Text="{Binding Path=EditableCategoryModel.Description, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="250" Grid.Column="1" Grid.Row="2" Height="45" VerticalScrollBarVisibility="Auto"/>
                                    <TextBlock AutomationProperties.AutomationId="txtbxDescCategory" HorizontalAlignment="Right" Text="Description:" TextWrapping="Wrap" Margin="0,5,5,0" VerticalAlignment="Top" Grid.Row="2"/>
                                    <TextBlock AutomationProperties.AutomationId="blkAuthor" Text="Author:" TextWrapping="Wrap" VerticalAlignment="Top" Grid.Row="4" Margin="0,5,5,0" HorizontalAlignment="Right"/>
                                    <TextBlock AutomationProperties.AutomationId="blkIcon" Text="Icon:" TextWrapping="Wrap" Grid.Row="8" Margin="0,5,5,0" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                                    <TextBlock AutomationProperties.AutomationId="blkCreatedDate" Text="Created Date:" TextWrapping="Wrap" Grid.Row="5" Margin="0,5,5,0" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                                    <TextBlock AutomationProperties.AutomationId="blkModifiedBy" Text="Modified By:" TextWrapping="Wrap" Margin="0,5,5,0" Grid.Row="6" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                                    <TextBlock AutomationProperties.AutomationId="blkModifiedDate" Text="Modified Date:" TextWrapping="Wrap" Margin="0,5,5,0" Grid.Row="7" VerticalAlignment="Top" HorizontalAlignment="Right"/>
                                    <TextBox AutomationProperties.AutomationId="bxId" Text="{Binding Path=EditableCategoryModel.DisplayId}" TextWrapping="Wrap" Grid.Column="1" Grid.Row="0" Width="250" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" IsEnabled="False" Grid.RowSpan="1"/>
                                    <TextBox AutomationProperties.AutomationId="bxCreatedBy" Text="{Binding Path=EditableCategoryModel.CreatedBy}" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="4" Grid.Column="1" Width="250" Margin="0,5,0,0" IsEnabled="False" Grid.RowSpan="1"/>
                                    
                                    <TextBox AutomationProperties.AutomationId="bxModifiedBy" Text="{Binding Path=EditableCategoryModel.LastModifiedBy}" TextWrapping="Wrap" Grid.Column="1" Grid.Row="6" Width="250" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" IsEnabled="False" Grid.RowSpan="1"/>
                                    <Grid Margin="0,5,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.Row="5" HorizontalAlignment="Left">
                                        <TextBox AutomationProperties.AutomationId="bxCreatedDate" IsEnabled="False" Text="{Binding Path=EditableCategoryModel.DisplayCreatedDate}" TextWrapping="Wrap"  Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="250"/>
                                    </Grid>
                                    <Grid Margin="0,5,0,0" Grid.Column="1" Grid.Row="7" HorizontalAlignment="Left" VerticalAlignment="Top">
                                        <TextBox AutomationProperties.AutomationId="bxModifiedDate" IsEnabled="False" Text="{Binding Path=EditableCategoryModel.DisplayLastModifiedTime}" TextWrapping="Wrap" Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="250"/>
                                    </Grid>
                                    <Grid VerticalAlignment="Top" Grid.Row="3" Margin="0,5,8,0" HorizontalAlignment="Right">
                                        <Grid Margin="0,-0.5,-7.5,0" Width="8" Height="8" HorizontalAlignment="Right" VerticalAlignment="Top">
                                            <Path RenderTransformOrigin="0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom" Fill="#FFFF0000" Stretch="Fill" StrokeThickness="0" Data="M18.597656,17.335052 L25.59375,17.335052 L25.382813,29.253021 L36.210938,22.010834 L39.832031,27.424896 L27.667969,34.561615 L39.832031,41.768646 L36.210938,47.112396 L25.242188,39.624115 L25.628906,51.85849 L18.597656,51.85849 L18.808594,39.975677 L8.0859375,47.147552 L4.5,41.73349 L16.59375,34.596771 L4.5703125,27.38974 L8.0859375,21.975677 L18.808594,29.253021 z">
                                                <Path.RenderTransform>
                                                    <TransformGroup>
                                                        <ScaleTransform ScaleX="0.7" ScaleY="0.7"/>
                                                        <SkewTransform AngleX="0" AngleY="0"/>
                                                        <RotateTransform Angle="0"/>
                                                        <TranslateTransform X="0" Y="0"/>
                                                    </TransformGroup>
                                                </Path.RenderTransform>
                                            </Path>
                                        </Grid>
                                        <TextBlock Margin="-2,0,0,0" AutomationProperties.AutomationId="blkCategory" Text="Category:" TextWrapping="Wrap"/>
                                    </Grid>
                                    <TextBox AutomationProperties.AutomationId="brdCrumb" Text="{Binding Path=EditableCategoryModel.CategoryParentBreadcrumb}" ToolTipService.ShowOnDisabled="True" ToolTip="{Binding Path=EditableCategoryModel.CategoryParentBreadcrumb}" TextWrapping="NoWrap" Margin="0,5,0,0" Width="250" HorizontalAlignment="Left" Grid.Column="1" Grid.Row="3" VerticalAlignment="Top" IsEnabled="False"/>
                                    <Button IsEnabled="{Binding Path=NonSystemItem}" AutomationProperties.AutomationId="btnBrowseCategory" HorizontalAlignment="Left" Content="..." ToolTip="Browse" Command="{Binding Path=BrowseCategoryCommand}" Width="30" Margin="255,5,0,0" Grid.Column="1" VerticalAlignment="Top" Grid.Row="3"/>
                                    
                                    <Grid Grid.Column="1" Grid.Row="8" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,5,0,0">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto" MinHeight="26" />
                                            <RowDefinition Height="Auto" MinHeight="26" />
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="60"/>
                                            <ColumnDefinition/>
                                        </Grid.ColumnDefinitions>
                                        <Button IsEnabled="{Binding Path=NonSystemItem}" AutomationProperties.AutomationId="btnBrowseImage" Command="{Binding Path=BrowseImageCommand}" HorizontalAlignment="Left" VerticalAlignment="Center" Content="Browse" Width="80" Margin="5,0,0,0" Grid.Row="0" Grid.Column="1"/>
                                        <Border BorderBrush="LightGray" CornerRadius="3" BorderThickness="2" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,0,0" Grid.Column="0" Grid.Row="0" Grid.RowSpan="2">
                                            <Image AutomationProperties.AutomationId="img" Width="50">
                                                <Image.Source>
                                                    <PriorityBinding FallbackValue="EditableCategoryModel.DefaultImage">
                                                        <Binding Path="EditableCategoryModel.PreviewImage" IsAsync="True"/>
                                                        <Binding Path="EditableCategoryModel.RegistryImage" IsAsync="True"/>
                                                        <Binding Path="EditableCategoryModel.DefaultImage"/>
                                                    </PriorityBinding>
                                                </Image.Source>
                                            </Image>
                                        </Border>
                                        <Button IsEnabled="{Binding Path=NonSystemItem}" AutomationProperties.AutomationId="btnDef" Command="{Binding Path=RevertToDefIconCommand}" HorizontalAlignment="Left" VerticalAlignment="Center" Content="Use default" Width="80" Margin="5,0,0,0" Grid.Row="1" Grid.Column="1"/>
                                    </Grid>
                                </Grid>
                            </Border>
                        </StackPanel>
                    </Grid>
                </ScrollViewer>

                <Border  Grid.Row="2"  BorderBrush="#FFC1C1C1" BorderThickness="0,1,0,0" Padding="0,10,0,0" >
                    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
                        <Button IsEnabled="{Binding Path=NonSystemItem}" AutomationProperties.AutomationId="btnSave" Name="btnSave" Command="{Binding Path=SaveCategoryChangesCommand}" CommandParameter="{x:Null}" HorizontalAlignment="Right"  Margin="0,0,80,0" VerticalAlignment="Top" Width="70" Content="Save"/>
                        <Button IsEnabled="{Binding Path=NonSystemItem}" AutomationProperties.AutomationId="btnCancel" Command="{Binding Path=CancelCategoryChangesCommand}" HorizontalAlignment="Right" Width="70" Content="Cancel"  VerticalAlignment="Top"/>
                    </Grid>
                </Border>
            </Grid>
        </Border>
    </Grid>
</UserControl>
